﻿using ProjBackEnd.Areas.BizProj.Models;
using ProjBackEnd.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ProjBackEnd.Areas.Financial.Models
{
    public class ResultBill : BaseResultInfoPaging
    {
        /// <summary>
        /// 账单信息
        /// </summary>
        public List<BillExtInfo> billextlist { get; set; } = new List<BillExtInfo>();
    }
    public class ReqBillSens : BaseUserRequest
    {
        /// <summary>
        /// 账单敏感信息
        /// </summary>
        public BillCore billcore { get; set; }
    }
    public class ReqBillBase : BaseUserRequest
    {
        /// <summary>
        /// 账单基本信息
        /// </summary>
        public BillBaseInfo billbaseinfo { get; set; }
    }

    /// <summary>
    /// i 账单敏感信息
    /// </summary>
    public class BillCore : BaseOperableEntity
    {
        /// <summary>
        /// 账单id
        /// </summary>
        [RequiredConditional("optlb","UD",ErrorMessage ="账单流水号是必需的")]
        public int billid { get; set; }
        /// <summary>
        /// 账单归属科目
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "账单归属科目是必需的")]
        public string billtp { get; set; }
        /// <summary>
        /// 收付费标志
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "收付费标志是必需的")]
        public string rplb { get; set; }
        /// <summary>
        /// 收付费客户id
        /// </summary>
        [RequiredConditional("optlb", "I", ErrorMessage = "收付费客户是必需的")]
        public int cusid { get; set; }
        /// <summary>
        /// 进程id
        /// </summary>
        public string pid { get; set; }
        /// <summary>
        /// 审批流程模板id
        /// </summary>
        public int revcaseid { get; set; }
        /// <summary>
        /// 预结金额
        /// </summary>
        public decimal amt_pre { get; set; }
    }

    /// <summary>
    /// ii 账单基本信息
    /// </summary>
    public class BillBaseInfo : BillCore
    {
        /// <summary>
        /// 发票类别
        /// </summary>
        public string invotp { get; set; }
        /// <summary>
        /// 税率
        /// </summary>
        public decimal taxrate { get; set; } = -1;
        /// <summary>
        /// 备注信息
        /// </summary>
        public string remark { get; set; }
    }

    /// <summary>
    /// iii 账单扩展信息
    /// </summary>
    public class BillExtInfo : BillBaseInfo
    {
        /// <summary>
        /// 收费金额
        /// </summary>
        public decimal amt_rec { get; set; }
        /// <summary>
        /// 付费金额
        /// </summary>
        public decimal amt_pay { get; set; }
        /// <summary>
        /// 已收金额
        /// </summary>
        public decimal amt_rec_ed { get; set; }
        /// <summary>
        /// 已付金额
        /// </summary>
        public decimal amt_pay_ed { get; set; }
        /// <summary>
        /// 账单归属科目名称
        /// </summary>
        public string billtpnm { get; set; }
        /// <summary>
        /// 审批流程模板名称
        /// </summary>
        public string revcasenm { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        public string cusnm { get; set; }
        /// <summary>
        /// 建档人
        /// </summary>
        public string creator { get; set; }
        /// <summary>
        /// 建档时间
        /// </summary>
        public string createdt { get; set; }
        /// <summary>
        /// 进程描述
        /// </summary>
        public string pidnm { get; set; }
        /// <summary>
        /// 审批序号
        /// </summary>
        public int approvalsort { get; set; }
        /// <summary>
        /// 发票类型名称
        /// </summary>
        public string invotpnm { get; set; }
        /// <summary>
        /// 账单提交审批时间
        /// </summary>
        public string submitdt { get; set; } = "";
    }

    public class ReqAdjustBillDetail : BaseUserRequest
    {
        /// <summary>
        /// 账单流水号
        /// </summary>
        [Required(ErrorMessage = "账单流水号是必需的")]
        public int billid { get; set; }

        /// <summary>
        /// 操作标识符
        /// </summary>
        [Required(ErrorMessage = "操作标识符是必需的")]
        public string optlb { get; set; }

        private List<BizFeeCore> lstFee = new List<BizFeeCore>();
        /// <summary>
        /// 账单明细列表
        /// </summary>
        [Required(ErrorMessage = "账单明细是必需的")]
        public List<BizFeeCore> feelist { get { return lstFee; } set { lstFee = value; } }
    }

    public class ResultBillRevFlow : BaseResultInfo
    {
        /// <summary>
        /// 申请单审批流程
        /// </summary>
        public List<ApplyRevFlow> applyrevflow { get; set; }
    }

    /// <summary>
    /// 申请单审批信息
    /// </summary>
    public class ApplyRevFlow
    {
        /// <summary>
        /// 审批顺序
        /// </summary>
        public int sortval { get; set; }
        /// <summary>
        /// 审批人1
        /// </summary>
        public string reviewernm1 { get; set; }
        /// <summary>
        /// 审批标志1：Y-已审批；N-未审批
        /// </summary>
        public string revlb1 { get; set; }
        /// <summary>
        /// 审批日期1
        /// </summary>
        public string revdt1 { get; set; }
        /// <summary>
        /// 审批人2
        /// </summary>
        public string reviewernm2 { get; set; }
        /// <summary>
        /// 审批标志2：Y-已审批；N-未审批
        /// </summary>
        public string revlb2 { get; set; }
        /// <summary>
        /// 审批日期2
        /// </summary>
        public string revdt2 { get; set; }
        /// <summary>
        /// 上一级审批完成时间
        /// </summary>
        public string submitdt { get; set; }
        /// <summary>
        /// 审批类别名称
        /// </summary>
        public string revtpnm { get; set; }
    }

}